import request from "@/utils/request";

// 查询人员花名册列表
export function listStaff(query) {
  return request({
    url: "/cld/staff/list",
    method: "get",
    params: query,
  });
}

// 查询人员花名册详细
export function getStaff(staffId) {
  return request({
    url: "/cld/staff/" + staffId,
    method: "get",
  });
}

// 新增人员花名册
export function addStaff(data) {
  return request({
    url: "/cld/staff",
    method: "post",
    data: data,
  });
}


// 恢复已入职
export function reinstatementStaff(staffId) {
  return request({
    url: "/cld/staff/reinstatementStaff/"+staffId,
    method: "post",
  });
}

// 修改人员花名册
export function updateStaff(data) {
  return request({
    url: "/cld/staff",
    method: "put",
    data: data,
  });
}

// 员工离职申请
export function resignStaff(data) {
  return request({
    url: "/cld/staff/resign",
    method: "put",
    data: data,
  });
}

// 删除人员花名册
export function delStaff(staffId) {
  return request({
    url: "/cld/staff/" + staffId,
    method: "delete",
  });
}

// 查询人员花名册列表
export function getListStaff(query) {
  return request({
    url: "/cld/staff/getList",
    method: "get",
    params: query,
  });
}

// 人员花名册统计
export function selectCldStaffAnalyze() {
  return request({
    url: "/cld/staff/selectCldStaffAnalyze",
    method: "get",
  });
}


// 重置密码
export function resetPasswordStaff(staffId, password) {
  const data = {
    staffId,
    password
  }
  return request({
    url: '/cld/staff/resetPwd',
    method: 'put',
    data: data
  })
}